#-------------------------------------------------------------------------------
# Name:        module1
# Purpose:
#
# Author:      Antonio
#
# Created:     16/06/2014
# Copyright:   (c) Antonio 2014
# Licence:     <your licence>
#-------------------------------------------------------------------------------

import pygame, sys, time
from pygame.locals import *


largura, altura = 451, 451
Branco = (255,255,255)

pygame.init()

tela = pygame.display.set_mode((largura, altura), 0 , 32)
pygame.display.set_caption("Walking Of The Edge")


def verificaMouse(img_botao,pos_botao,pos_mouse):
    img_x, img_y = pos_botao
    img_w, img_h = img_botao.get_size()
    varia_x = img_x + img_w
    varia_y = img_y + img_h
    if pos_mouse[0] > img_x and pos_mouse[0] < varia_x and pos_mouse[1] > img_y and pos_mouse[1] < varia_y:
        return True
    return False

def NovoJogo():

    tela.fill(Branco)
    pygame.display.flip()


def MenuInicial():

    fundo= pygame.image.load('G:\Python\Python Portable\Projeto - Tabuleiro\Imagens\logo.jpg').convert()
    botaoJogar = pygame.image.load('G:\Python\Python Portable\Projeto - Tabuleiro\Imagens\lotaojogar.JPG').convert_alpha()
    posBotaoJogar = (0,0)


    while True:
        for event in pygame.event.get():
            if event.type == QUIT:
                pygame.quit()
                sys.exit()

        xy = pygame.mouse.get_pos()

        tela.blit(fundo,(0,0))
        tela.blit(botaoJogar,posBotaoJogar)

        if verificaMouse(botaoJogar,posBotaoJogar,xy) == True:
            if event.type == MOUSEBUTTONDOWN and event.button == 1:
                NovoJogo()

        pygame.display.flip()


MenuInicial()